{% load djblets_extensions djblets_utils i18n reviewtags staticfiles %}

{% template_hook_point "before-review-request-summary" %}

<div class="review-request-section review-request-summary">
{% template_hook_point "review-request-summary-pre" %}

 <label class="review-request-section-label" for="field_summary">{% trans "Summary" %}: </label>
{% review_request_field review_request_details 'summary' %}
 {{field.as_html}}
{% end_review_request_field %}
 <p>
{%  blocktrans with review_request.display_id as review_request_id and review_request.get_absolute_url as review_request_url %}
  Review Request <a href="{{review_request_url}}">#{{review_request_id}}</a>
  &mdash;
  {{review_request_status_html}}
{%  endblocktrans %}
 </p>

{% template_hook_point "review-request-summary-post" %}
</div>

{% template_hook_point "after-review-request-summary" %}

<div id="review-request-warning"></div>

{% template_hook_point "before-review-request-fields" %}

<table id="review-request-details" class="review-request-section">
 <colgroup>
  <col width="0%" />
  <col width="100%" />
 </colgroup>
{% for_review_request_fieldset review_request_details %}
{%  if fieldset.fieldset_id != 'main' and fieldset.fieldset_id != 'extra' %}
 <thead id="fieldset_{{fieldset.fieldset_id}}_head"{% if forloop.first %} class="first-fieldset"{% endif %}>
  <tr>
   <th class="review-request-section-label" colspan="2">{{fieldset.label}}
{%   if show_fieldset_required %}
    <span class="required-flag" aria-label="{% trans 'This field is required' %}" title="{% trans 'This field is required' %}">*</span>
{%   endif %}
  </tr>
 </thead>
 <tbody id="fieldset_{{fieldset.fieldset_id}}_body">
{%   for_review_request_field review_request_details fieldset %}
  <tr>
   <th><label for="field_{{field.field_id}}">{{field.label}}:</label></th>
   <td>{{field.as_html}}</td>
  </tr>
{%   end_for_review_request_field %}
 </tbody>
{%  endif %}
{% end_for_review_request_fieldset %}
</table>

<div id="review-request-main">
{% for_review_request_field review_request_details 'main' %}
{%  if field.field_id != 'summary' %}
 <div class="review-request-section">
  <label class="review-request-section-label" for="field_{{field.field_id}}">{{field.label}}</label>
  <div class="field-container">{{field.as_html}}</div>
 </div>
{%  endif %}
{% end_for_review_request_field %}
</div>

{% template_hook_point "after-review-request-fields" %}
{% template_hook_point "before-review-request-extra-panes" %}

<div id="review-request-extra">
{% for_review_request_field review_request_details 'extra' %}
 <div class="review-request-section">
  <label class="review-request-section-label" for="field_{{field.field_id}}">{{field.label}}</label>
  <div class="field-container">{{field.as_html}}</div>
 </div>
{% end_for_review_request_field %}
{% template_hook_point "review-request-extra-panes-pre" %}

 <div class="review-request-section"{% if not screenshots %} style="display: none;"{% endif %}>
  <label class="review-request-section-label">{% trans "Screenshots" %}</label>
  <div id="screenshot-thumbnails">
{% for image in screenshots %}
   <div class="screenshot-container" data-screenshot-id="{{image.id}}">
    <div class="image" onclick="javascript:window.location='{{image.get_absolute_url}}'; return false;"><a href="{{image.get_absolute_url}}">{{image.thumb}}</a></div>
    <div class="screenshot-caption">
     <a href="{{image.get_absolute_url}}" class="edit">{% if draft %}{{image.draft_caption|default:image.caption}}{% else %}{{image.caption}}{% endif %}</a>
{%  if request.user.pk == review_request.submitter_id or perms.reviews.delete_screenshot %}
{%   if review_request.status == 'P' %}
     <a href="#" class="delete rb-icon rb-icon-delete" title="{% trans "Delete Screenshot" %}"></a>
{%   endif %}
{%  endif %}
    </div>
   </div>
{% endfor %}
   <br clear="both" />
  </div>
 </div>

 <div id="file-list-container" class="review-request-section clearfix"{% if not file_attachments %} style="display: none;"{% endif %}>
  <label class="review-request-section-label">{% trans "Files" %}</label>
  <div id="review-request-files-placeholder">
   <span class="fa fa-spinner fa-pulse" aria-hidden="true"></span>
   {% trans "Loading file attachments..." %}
  </div>
  <div id="file-list">
   <br clear="both" />
  </div>
 </div>

{% if show_issue_summary_table %}
{%  include "reviews/review_issue_summary_table.html" %}
{% endif %}

{% template_hook_point "review-request-extra-panes-post" %}
</div>

{% template_hook_point "after-review-request-extra-panes" %}
